import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/invite_entity.dart';

InviteEntity $InviteEntityFromJson(Map<String, dynamic> json) {
  final InviteEntity inviteEntity = InviteEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    inviteEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    inviteEntity.msg = msg;
  }
  final List<InviteData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<InviteData>(e) as InviteData).toList();
  if (data != null) {
    inviteEntity.data = data;
  }
  return inviteEntity;
}

Map<String, dynamic> $InviteEntityToJson(InviteEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension InviteEntityExtension on InviteEntity {
  InviteEntity copyWith({
    int? code,
    String? msg,
    List<InviteData>? data,
  }) {
    return InviteEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

InviteData $InviteDataFromJson(Map<String, dynamic> json) {
  final InviteData inviteData = InviteData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    inviteData.id = id;
  }
  final String? userName = jsonConvert.convert<String>(json['user_name']);
  if (userName != null) {
    inviteData.userName = userName;
  }
  final String? nickName = jsonConvert.convert<String>(json['nick_name']);
  if (nickName != null) {
    inviteData.nickName = nickName;
  }
  final String? userPhoto = jsonConvert.convert<String>(json['user_photo']);
  if (userPhoto != null) {
    inviteData.userPhoto = userPhoto;
  }
  final String? regTime = jsonConvert.convert<String>(json['reg_time']);
  if (regTime != null) {
    inviteData.regTime = regTime;
  }
  return inviteData;
}

Map<String, dynamic> $InviteDataToJson(InviteData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['user_name'] = entity.userName;
  data['nick_name'] = entity.nickName;
  data['user_photo'] = entity.userPhoto;
  data['reg_time'] = entity.regTime;
  return data;
}

extension InviteDataExtension on InviteData {
  InviteData copyWith({
    int? id,
    String? userName,
    String? nickName,
    String? userPhoto,
    String? regTime,
  }) {
    return InviteData()
      ..id = id ?? this.id
      ..userName = userName ?? this.userName
      ..nickName = nickName ?? this.nickName
      ..userPhoto = userPhoto ?? this.userPhoto
      ..regTime = regTime ?? this.regTime;
  }
}